<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        table {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        td {
            padding: 10px;
        }
        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input[type="submit"],
        input[type="button"] {
            background-color: #28a745;
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 5px;
            cursor: pointer;
            width: 100%; /* Ensures buttons are the same width */
            margin-top: 10px; /* Adds space between buttons */
        }
        input[type="submit"]:hover,
        input[type="button"]:hover {
            opacity: 0.9;
        }
        #messageError {
            margin-top: 10px;
            color: red;
        }
    </style>
</head>
<body>
<form th:action="@{/user/register}" method="post" name="registerForm">
    <table>
        <tr>
            <td align="center" colspan="2"><strong>注册</strong></td>
        </tr>
        <tr>
            <td>用户名：</td>
            <td><input type="text" name="uname" required/></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" name="upwd" required/></td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <input type="submit" value="注册"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <!-- 返回按钮 -->
                <input type="button" value="返回" onclick="window.location.href='/user/index';"/>
            </td>
        </tr>
    </table>
    <div id="messageError" th:text="${errorMessage}"></div>
</form>
</body>
</html>
